package com.example.attempt.service.impl;

import com.example.attempt.entity.Teacher;
import com.example.attempt.mapper.TeacherMapper;
import com.example.attempt.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacherServiceImpl implements TeacherService {
    @Autowired
    TeacherMapper teacherMapper;
    @Override
    public List<Teacher> queryAll() {

        return teacherMapper.queryAll();
    }

    @Override
    public int addTeacher(Teacher teacher) {
        teacherMapper.addTeacher(teacher);
        return 1;
    }

//    @Override
//    public int addTeachers(List<Teacher> teachers) {
////        Teacher teacher=new Teacher();
//        for(int i = 0; i < teachers.size(); i++){
//            Teacher teacher = teachers.get(i);
////            teacher.setTid((teacherMapper.getNum()+1)+"");
//            teachers.add(teacher);
//        }
//        return 1;
//    }

    @Override
    public Teacher queryById(String tid) {
        return teacherMapper.queryById(tid);
    }

    @Override
    public int getNum() {
        return teacherMapper.getNum();
    }

    @Override
    public Teacher queryByIdAndP(String tid, String tpwd){
        return teacherMapper.queryByIdAndP(tid, tpwd);
    }

    @Override
    public void deleteTeacher(String tid) {
        teacherMapper.deleteTeacher(tid);
    }
}
